#ifndef _PACKAGE_H_
#define _PACKAGE_H_

#include <iostream>
#include <stdlib.h>

class Package
{
public:
	Package();

	virtual ~Package();

	void init(char* buffer);

	unsigned short getIdentValue();
	unsigned char getVersionValue();
	unsigned char getTypeValue();
	unsigned int getSessinIdValue();
	unsigned int getCrc32Value();
	unsigned int getSizeValue();
	unsigned long long getTimestampValue();

	virtual void inbody(char* buffer);

	void setIdentValue(unsigned short value);
	void setVersionValue(unsigned char value);
	void setTypeValue(unsigned char value);
	void setSessinIdValue(unsigned int value);
	void setCrc32Value(unsigned int value);
	void setSizeValue(unsigned int value);
	void setTimestampValue(unsigned long long value);

	void make_table();
	unsigned int getCrc32(unsigned int crc, char* buff, int len);

	//Package operator=(const Package package);

private:
	unsigned short ident;
	unsigned char version;
	unsigned char type;
	unsigned int sessinId;
	unsigned int crc32;
	unsigned int size;
	unsigned long long timestamp;
};

#endif // !_PACKAGE_H_
